package edu.task.repository;

import edu.task.model.SysProjectTask;
import edu.task.model.SysProjectTaskPK;
import edu.task.model.SysRoleMenu;
import edu.task.model.SysRoleMenuPK;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface SysProjectTaskRepository extends JpaRepository<SysProjectTask, SysProjectTaskPK> {

    @Modifying
    @Query(value = "delete pt from sys_project_task as pt " +
            "inner join sys_project as p on pt.project_id = p.project_id " +
            "inner join sys_task as t on pt.task_id = t.task_id " +
            "where pt.task_id=:taskId ", nativeQuery = true)
    void deleteProjectTaskByTaskId(Long taskId);
}
